package com.bzchao.ds.demo.demo.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.bzchao.ds.demo.demo.entity.SysUser;
import com.bzchao.ds.demo.demo.mapper.SysUserMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 用户管理
 */
@RestController
@RequestMapping("/sys/user")
@Api(tags = "系统用户")
public class SysUserController {
    @Autowired
    private SysUserMapper sysUserMapper;

    @ApiOperation(value = "根据ID查询")
    @GetMapping("/get")
    public SysUser get(Long userId) {
        return sysUserMapper.selectById(userId);
    }

    @ApiOperation(value = "所有用户")
    @GetMapping("/all")
    public List<SysUser> all() {
        return sysUserMapper.selectList(new LambdaQueryWrapper<>());
    }

}
